package com.gaoyi.crm.adapter;

import android.content.Context;

import com.gaoyi.crm.BR;
import com.gaoyi.crm.R;
import com.gaoyi.crm.adapter.base.BaseAdapter;
import com.gaoyi.crm.adapter.base.BaseDtoAdapter;
import com.gaoyi.crm.adapter.base.BaseViewHolder;
import com.gaoyi.crm.databinding.RvNoSyncPmnBinding;
import com.gaoyi.crm.db.entity.PmnWithList;

public class NoSyncPmnAdapter extends BaseAdapter<RvNoSyncPmnBinding, PmnWithList> {

    public NoSyncPmnAdapter(Context context) {
        super(context);
    }

    @Override
    protected void setBindingVariable(RvNoSyncPmnBinding binding) {
        binding.setVariable(BR.format, "yyyy/MM/dd");
    }

    @Override
    protected void onBindItem(RvNoSyncPmnBinding binding, PmnWithList item, int position) {
        binding.tvProId.setSelected(item.isCheck());
    }

    @Override
    protected void onCreateView(RvNoSyncPmnBinding binding, BaseViewHolder holder) {
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.rv_no_sync_pmn;
    }

    public void changeSelected(int position) {
        getCurrentList().get(position).setCheck(!getCurrentList().get(position).isCheck());
        notifyItemChanged(position);
    }
}
